package com.example.demo.strategy;

/**
 * 鸭子
 *
 * @author Liu Huijun
 * @date 2023-02-08
 */
public class Duck {

    private FlyBehavior flyBehavior;

    private QuackBehavior quackBehavior;

    public void swim(){}

    public void display(){}

    public void setFlyBehavior(FlyBehavior flyBehavior) {
        this.flyBehavior = flyBehavior;
    }

    public void setQuackBehavior(QuackBehavior quackBehavior) {
        this.quackBehavior = quackBehavior;
    }

    public void performFly(){
        flyBehavior.fly();
    }

    public void performQuack(){
        quackBehavior.quack();
    }
}
